namespace HZY.Framework.Aop;

/// <summary>
/// aop 扩展类
/// </summary>
public static class AopExtensions
{
    public static WebApplicationBuilder AddAop(this WebApplicationBuilder builder)
    {
        AopMoAttribute.SetWebApplicationBuilder(builder);
        builder.Host.UsePinnedScopeServiceProvider();
        return builder;
    }

    /// <summary>
    /// use aop
    /// </summary>
    /// <param name="host"></param>
    /// <returns></returns>
    public static IHost UseAop(this WebApplication host)
    {
        // 设置host
        AopMoAttribute.SetHost(host);
        return host;
    }
}